import { request } from '../../utils/request'

// 获取所有权限点
export const common = {
  upload: data => {
    return new Promise((resolve, reject) => {
      uni.uploadFile({
        url: 'http://192.168.0.184:84/admin/upload/single-image',
        filePath: data.filePath,
        name: 'image',
        header: data.header,
        formData: {
          file: data.file
        },
        success: res => {
          resolve(JSON.parse(res.data))
        },
        fail: err => {
          reject(err)
        }
      })
    })
  },
  sendCode: data => {
    return request({
      url: '/adminapp/send-code',
      data,
      method: 'post',
      hideToast: true
    })
  },
  cancellation: data => {
    return request({
      url: '/adminapp/coupon-cancellation',
      data,
      hideToast: true
    })
  }
}
